home *** CD-ROM | disk | FTP | other *** search
/ Openstep 4.2 (Developer) / Openstep Developer 4.2.iso / NextLibrary / Frameworks / NIAccess.framework / Versions / A / Headers / NINetInfo.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  4.6 KB  |  168 lines

  1. /*
  2.     NINetInfo.h
  3.     Abstraction of the NetInfo administrative information system
  4.     Copyright (c) 1994, NeXT Computer, Inc.
  5.     All rights reserved.
  6. */
  7.  
  8. #ifndef STRICT_OPENSTEP
  9.  
  10. /*
  11.  * Common declarations for all NetInfo access classes.
  12.  */
  13. #define NIDefaultReadTimeout 30
  14. #define NIDefaultWriteTimeout 30
  15.  
  16. enum NIStatus {
  17.     NIOperationSucceeded = 0,
  18.     NIInvalidDirectory = 1,
  19.     NIStaleDirectory = 2,
  20.     NINoSpace = 3,
  21.     NIPermissionDenied = 4,
  22.     NINoSubdirectories = 5,
  23.     NIInvalidProperty = 6,
  24.     NIInvalidValue = 7,
  25.     NIDirectoryHasSubdirectories = 8,
  26.     NINotASubdirectory = 9,
  27.     NISerializationError = 10,
  28.     NIRootDomain = 11,
  29.     NICantContactParent = 12,
  30.     NIReadOnlyDatabase = 13,
  31.     NISystemError = 14,
  32.     NICantRegenerate = 15,
  33.     NIInvalidOperationOnClone = 16,
  34.     NICantFindAddress = 17,
  35.     NIDuplicateTag = 18,
  36.     NINoTag = 19,
  37.     NIAuthenticationError = 20,
  38.     NIInvalidUser = 21,
  39.     NIMasterServerIsBusy = 22,
  40.     NIInvalidDomain = 23,
  41.     NIInvalidOperationOnMaster = 24,
  42.     NICommunicationFailure = 9999,
  43. };
  44. typedef enum NIStatus NIStatus;
  45.  
  46. enum NIServerInfoIndex {
  47.     NIServerInfoHostNameIndex = 0,
  48.     NIServerInfoAddressIndex = 1,
  49.     NIServerInfoTagIndex = 2,
  50.     NIServerInfoDomainNameIndex = 3,
  51. };
  52.  
  53. #import <Foundation/NSDate.h>
  54. #import <Foundation/NSLock.h>
  55. #import <Foundation/NSArray.h>
  56. #import <Foundation/NSString.h>
  57. #import <Foundation/NSBundle.h>
  58. @class NIDirectory;
  59. @class NIDomain;
  60.  
  61. @interface NINetInfo : NSObject <NSLocking>
  62. {
  63.     @private
  64.     NSTimeInterval defaultReadTimeout;
  65.     NSTimeInterval defaultWriteTimeout;
  66.     NSLock *netinfoLock;
  67.     NSBundle *niBundle;
  68.     BOOL _didInit;
  69.     BOOL niLog;
  70.     BOOL useThreadLock;
  71.     id reserved;
  72. }
  73.  
  74. /*
  75.  * Get the shared NINetInfo instance.
  76.  * equivalent to [[NINetInfo alloc] init]
  77.  */ 
  78. + (NINetInfo *)netinfo;
  79.  
  80. /*
  81.  * A dictionary containing information on the status of the last
  82.  * NetInfo transaction.  Returns nil if the last transaction did
  83.  * not generate an error.
  84.  *
  85.  * Each thread has it's own status dictionary.
  86.  * The dictionary contains NSStrings for keys.  The keys are:
  87.  *
  88.  * status    - (NSNumber *) NIStatus of the last operation
  89.  * message   - (NSString *) Localized string description of the status code
  90.  * sender    - (NSString *) description of the caller
  91.  * operation - (NSString *) the operation performed
  92.  * domain    - (NSString *) description of the domain
  93.  * directory - (NSString *) description of the directory
  94.  * key       - (NSString *) description of the key
  95.  * value     - (NSString *) description of the value
  96.  */
  97. - (NSDictionary *)statusDictionary;
  98.  
  99. /*
  100.  * Get the NIStatus from the last NetInfo transaction.  Same as the status
  101.  * in the statusDictionary.
  102.  */
  103. - (NIStatus)netinfoStatus;
  104.  
  105. /*
  106.  * If enabled, the logging facility will log information about every
  107.  * NetInfo transaction.  Produces a lot ouf output!  Useful for debugging.
  108.  */
  109. - (void)enableLogging:(BOOL)flag;
  110. - (BOOL)isLoggingEnabled;
  111.  
  112. /*
  113.  * Locking facility to limit NetInfo RPC transtations to one thread at a
  114.  * time.  This is needed since NEXTSTEP's RPC is not thread safe.
  115.  * The default value is NO (for single-threaded programs).
  116.  */
  117. - (void)setEnableThreadLock:(BOOL)flag;
  118. - (BOOL)isThreadLockEnabled;
  119.  
  120. /*
  121.  * Get a string describing a status code.
  122.  */
  123. - (NSString *)errorMessage:(NIStatus)status;
  124.  
  125. /*
  126.  * Default read and write timeouts for NIDomain and NIServer connections.
  127.  */
  128. - (void)setDefaultReadTimeout:(NSTimeInterval)time;
  129. - (NSTimeInterval)defaultReadTimeout;
  130. - (void)setDefaultWriteTimeout:(NSTimeInterval)time;
  131. - (NSTimeInterval)defaultWriteTimeout;
  132.  
  133. /* 
  134.  * Search for directories in the domain hierarchy
  135.  *
  136.  * firstDirectoryWithPath: starts at the local domain and returns the 
  137.  * first directory found in a hierarchical lookup.
  138.  *
  139.  * firstDirectoryWithPath:startingDomain: does the same, starting at the
  140.  * given directory.
  141.  *
  142.  * lookupDirectoriesWithPath: (and lookupDirectoriesWithPath:startingDomain:)
  143.  * return all directories with the given path between the local domain
  144.  * (startingDomain) and the root domain.
  145.  *
  146.  * allDirectoriesWithPath: returns all directories with the given path in
  147.  * the local domain hierarchy.  Warning: this is very slow.
  148.  *
  149.  * allDirectoriesWithPath:inHierarchyWithDomain: returns all directories with
  150.  * the given path in the domain hierarchy that includes the given domain.
  151.  * Warning: this is very slow.
  152.  */
  153. - (NIDirectory *)firstDirectoryWithPath:(NSString *)path;
  154. - (NIDirectory *)firstDirectoryWithPath:(NSString *)path
  155.     startingDomain:(NIDomain *)domain;
  156.  
  157. - (NSArray *)lookupDirectoriesWithPath:(NSString *)path;
  158. - (NSArray *)lookupDirectoriesWithPath:(NSString *)path
  159.     startingDomain:(NIDomain *)domain;
  160.  
  161. - (NSArray *)allDirectoriesWithPath:(NSString *)path;
  162. - (NSArray *)allDirectoriesWithPath:(NSString *)path
  163.     inHierarchyWithDomain:(NIDomain *)domain;
  164.  
  165. @end
  166.  
  167. #endif STRICT_OPENSTEP
  168.